package com.healthcloud.controller;

import com.healthcloud.entity.SysLogEntity;
import com.healthcloud.service.SysLogService;
import com.healthcloud.utils.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * 系统日志
 * Created by yu on 2017/6/6.
 */
@Controller
@RequestMapping("/sys/log")
@ApiIgnore
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    
    @RequestMapping(value = "/toLog",method=RequestMethod.GET)
    public String toRentMgr(String id,Model model){
        return "log/logmgr";	
    }
    
    @RequestMapping(value = "/searchLog")
    public @ResponseBody
    Map<String, Object>  searchLog(SysLogEntity bean,Model model, @ModelAttribute("pageParam")PageParam pageParam){
		Map<String, Object> map = new HashMap<String, Object>();
		List<SysLogEntity> list = sysLogService.queryList(bean, pageParam);
        int count = sysLogService.queryTotal(bean);
        map.put("dataList", list);
        map.put("iTotalRecords", count);
        map.put("iTotalDisplayRecords", count);
        map.put("sEcho", pageParam.getsEcho());
        return map; 
    }
    
}
